package com.zhuge_new.Dialog;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.amap.api.maps.model.Marker;
import com.bumptech.glide.Glide;
import com.flyco.dialog.widget.base.BaseDialog;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;
import com.maning.mndialoglibrary.MToast;
import com.zhuge_new.Activity.RedDisplayActivity;
import com.zhuge_new.R;
import com.zhuge_new.share.BaseHttp;
import com.zhuge_new.share.Const;
import com.zhuge_new.untils.StatusBarUtil;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by lenovo on 2018-09-13.
 */

public class RedBagDialog extends BaseDialog<RedBagDialog> implements View.OnClickListener {

    private Context context;
    private String threeHeadPhoto;
    private TextView red_name;
    private ImageView redhead;
    private ImageView red_open;
    private String name;

    private onYesOnclickListener yesOnclickListener;


    public void setYesOnclickListener( onYesOnclickListener onYesOnclickListener) {
        this.yesOnclickListener = onYesOnclickListener;
    }



    public RedBagDialog(Context context, String threeHeadPhoto) {
        super(context);
        setDialogTheme();
        this.context=context;
        this.threeHeadPhoto=threeHeadPhoto;
    }


    private void setDialogTheme() {
        requestWindowFeature(R.style.Dialog_Msg);
    }

    @Override
    public View onCreateView() {
        widthScale(0.8f);
        View view=View.inflate(context,R.layout.dialog_red,null);
        redhead = view.findViewById(R.id.red_head);
        red_name = view.findViewById(R.id.red_name);
        red_open = view.findViewById(R.id.red_open);
        return view;
    }

    @Override
    public void setUiBeforShow() {
        red_open.setOnClickListener(this);
        data();
        Glide.with(context)
                .load(threeHeadPhoto)
                .into(redhead);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.red_open:
                if (yesOnclickListener != null) {
                    yesOnclickListener.onYesClick();
                }
        }
    }

    public interface onYesOnclickListener {
        public void onYesClick();
    }

    private void data() {
        if (red_name==null){

        }else {
            red_name.setText(name);
        }
    }

    public void setName(String title) {
        name=title;
    }
}
